import request from '@/config/axios'

// 用户积分记录 VO
export interface UserPointsRecordVO {
  id: number // 主键
  userId: number // 用户编号
  title: string // 标题
  type: boolean // 变动类型（0减 1增）
  obtainedPoints: number // 积分变动数量
  recordTime: Date // 记录时间
  totalPoints: number // 积分变动后，用户剩余总积分
}

// 用户积分记录 API
export const UserPointsRecordApi = {
  // 查询用户积分记录分页
  getUserPointsRecordPage: async (params: any) => {
    return await request.get({ url: `/business/user-points-record/page`, params })
  },

  // 查询用户积分记录详情
  getUserPointsRecord: async (id: number) => {
    return await request.get({ url: `/business/user-points-record/get?id=` + id })
  },

  // 新增用户积分记录
  createUserPointsRecord: async (data: UserPointsRecordVO) => {
    return await request.post({ url: `/business/user-points-record/create`, data })
  },

  // 修改用户积分记录
  updateUserPointsRecord: async (data: UserPointsRecordVO) => {
    return await request.put({ url: `/business/user-points-record/update`, data })
  },

  // 删除用户积分记录
  deleteUserPointsRecord: async (id: number) => {
    return await request.delete({ url: `/business/user-points-record/delete?id=` + id })
  },

  // 导出用户积分记录 Excel
  exportUserPointsRecord: async (params) => {
    return await request.download({ url: `/business/user-points-record/export-excel`, params })
  },
}
